<template>
 <div class="one">
    <el-table
      :data="UlogList.slice((currentPage-1)*pagesize,currentPage*pagesize)"
      style="width: 100%;" >
      <el-table-column  prop="id"  label="编号"  width="180">
      </el-table-column>
      <el-table-column  prop="operateor" label="操作者"width="180">
      </el-table-column> 
      <el-table-column prop="operatetype" label="操作类型" align="center">
      </el-table-column>
       <el-table-column prop="operatedate" label="操作日期" align="center">
      </el-table-column>
       <el-table-column prop="operateresult" label="操作结果" align="center">
      </el-table-column>
       <el-table-column prop="remark" label="备注" align="center">
      </el-table-column>
        <el-table-column  label="操作" align="center">
          <template slot-scope="scops">
           <el-button type="primary" size="mini" icon="el-icon-delete" @click="DeleteUlog(scops.row.id)">删除</el-button>
          </template>
      </el-table-column>
    </el-table>
      <!-- 分页 -->
									  <el-pagination style="margin-top:20px ;"
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            :current-page="currentPage"
                            :page-sizes="[5, 8]" 
                            :page-size="pagesize"        
                            layout="total, sizes, prev, pager, next, jumper"
                            :total="UlogList.length">    
                    </el-pagination>

  </div>
</template>

<script>
export default {

  name:'Ulog',
  data(){
    return{
       currentPage:1, //初始页
       pagesize:8,    //    每页的数据
    UlogList:[{    
      id:'',
     operateor:'',
	   operatetype:'',
      operatedate:'',
	   operateresult:'',
	     remark:'',

    }]
    }
  },
  mounted(){
    this.getUlogData()
  }
  ,
  methods:{
    getUlogData:function(){
      this.$axios.get("/log/getUlogData").then(res=>{
        this.UlogList=res.data
        console.log(this.UlogList)
      })
    },
    DeleteUlog:function(id){
      this.$axios.get("/log/deleteUlogData",{params:{id:id}}).then(res=>{
          if(res.data!=0){
            alert("删除成功")
          }else{
            alert("删除失败")
          }
       this.$router.go(0)
      })
    }
    ,
    	//分页
		handleSizeChange: function (size) {
                this.pagesize = size;
                console.log(this.pagesize)  //每页下拉显示数据
        },
    handleCurrentChange: function(currentPage){
                this.currentPage = currentPage;
                console.log(this.currentPage)  //点击第几页
        },
    handleUserList() {
            this.$axios.get('http://localhost:8080/BMS/product/getproducts').then(res => {  //这是从本地请求的数据接口，
                this.userList = res.body
            })
        }
  }
}
</script>

<style>

</style>